import { createRouter, createWebHashHistory, createWebHistory, RouteRecordRaw } from "vue-router";
import Home from "../views/Home.vue";

const routes: Array<RouteRecordRaw> = [
  {
    path: "/",
    name: "Home",
    component: Home
  },
  {
    path: "/codeLife",
    name: "codeLife",
    component: () => import("@/views/codeLife.vue")
  },
  {
    path: "/codeShare",
    name: "codeShare",
    component: () => import("@/views/codeShare.vue")
  },
  {
    path: "/lifeWrite",
    name: "lifeWrite",
    component: () => import("@/views/lifeWrite.vue")
  },
  {
    path: "/manger",
    name: "manger",
    component: () => import("@/views/manger.vue")
  },
  {
    path: "/newArticle",
    name: "newArticle",
    component: () => import("@/views/newArticle.vue")
  },
  {
    path: "/des",
    name: "des",
    component: () => import("@/views/des.vue"),
    props: (route) => ({ type: route.query.type, id: route.query.id })
  },
  {
    path: "/technology",
    name: "technology",
    component: () => import("@/views/technology.vue")
  },
  {
    path: "/userInfo",
    name: "userInfo",
    component: () => import("@/views/userInfo.vue")
  }
];

const router = createRouter({
  history: createWebHashHistory(process.env.BASE_URL),
  routes
});

export default router;
